package com.crm.modules.controller;

import com.crm.modules.entities.FactoryMgmt;
import com.crm.modules.service.FactoryMgmtService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.RR;
import com.ruoyi.common.core.web.controller.AbstractController;
import com.ruoyi.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Z
 * @Date: 2024/7/21 18:18
 * @Description:
 */
@RestController
@RequestMapping("/factory")
public class FactoryMgmtController extends AbstractController {

    /**
     * 查询入驻厂家管理列表
     */
    @GetMapping("/list")
    public RR list(@RequestBody FactoryMgmt crmFactoryMgmt)
    {
        return callData(()->ref(FactoryMgmtService.class).selectList(crmFactoryMgmt));
    }

    @PostMapping("/insert")
    public RR insert(@RequestBody FactoryMgmt factoryMgmt){
        return callAuto(()->ref(FactoryMgmtService.class).insert(factoryMgmt));
    }

    @PostMapping("/updateById")
    public RR updateById(@RequestBody FactoryMgmt factoryMgmt){
        return callData(()->ref(FactoryMgmtService.class).updateById(factoryMgmt));
    }

    @PostMapping("/deleteIds")
    public RR deleteByIds(String[] ids){
        return callAuto(()->ref(FactoryMgmtService.class).deleteByIds(ids));
    }

    @GetMapping("/deleteById")
    public RR deleteById(@RequestParam("id") String id){
        return callAuto(()->ref(FactoryMgmtService.class).deleteById(id));
    }

}
